﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Diagnostics;
using System.IO;

public partial class Demo : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        this.Repeater1.DataSource = GetFiles(Server.MapPath("~/output"));
        this.Repeater1.DataBind();
    }

    protected IEnumerable<SWFFile> GetFiles(string dir)
    {
        foreach (string file in Directory.GetFiles(dir))
        {
            yield return new SWFFile() { Filename = Path.GetFileName(file), Path = "output/" + Path.GetFileName(file) };
        }
    }
    protected void Button1_Click1(object sender, EventArgs e)
    {
        string filename = this.FileUpload1.PostedFile.FileName;
        this.FileUpload1.PostedFile.SaveAs(Server.MapPath("~/upload/" + filename));
        Docs2SWF.SWFGenerator.FromWord(Server.MapPath("~/upload/" + filename), Server.MapPath("~/output/"));
        Response.Redirect(Request.RawUrl);
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        Response.Redirect(Request.RawUrl);
    }
}

public class SWFFile
{
    public string Filename { get; set; }
    public string Path { get; set; }
}